﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Marta.buchalska.wesele.Admin
{
    public partial class NewGallery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void NewGalleryForm_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            FormView f = (FormView)sender;
            DropDownList ddl = (DropDownList)f.FindControl("CategryList");
            e.Values["Photo_category_id"] = ddl.SelectedValue;
        }

        protected void NewGalleryForm_ItemInserted(object sender, FormViewInsertedEventArgs e)
        {
            if (!System.IO.Directory.Exists(Server.MapPath("~/img/" + e.Values["Name"])))
            {
                System.IO.Directory.CreateDirectory(Server.MapPath("~/img/" + e.Values["Name"]));
            }
            Response.Redirect("~/admin/PhotoGallery.aspx");
        }
    }
}